package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseFragment;
import com.isunland.managesystem.entity.DataStatus;
import com.isunland.managesystem.entity.rContractListMain;
import com.isunland.managesystem.utils.MyStringUtil;
import com.isunland.managesystem.widget.SingleLineView;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2017/7/5 17:26
 */
public class CustomerBillDetailFragment extends BaseFragment {
  @BindView(R.id.slv_partName) SingleLineView slvPartName;
  @BindView(R.id.slv_contractCode) SingleLineView slvContractCode;
  @BindView(R.id.slv_contractName) SingleLineView slvContractName;
  @BindView(R.id.slv_contractSignDate) SingleLineView slvContractSignDate;
  @BindView(R.id.slv_contractKind) SingleLineView slvContractKindName;
  @BindView(R.id.slv_requireDate) SingleLineView slvRequireDate;
  @BindView(R.id.slv_contractAmount) SingleLineView slvContractAmount;
  @BindView(R.id.slv_makedContractAmount) SingleLineView slvMakedContractAmount;
  @BindView(R.id.slv_residualContractAmount) SingleLineView slvResidualContractAmount;
  @BindView(R.id.slv_makedInvoiceAmount) SingleLineView slvMakedInvoiceAmount;
  @BindView(R.id.slv_residualInvoiceAmount) SingleLineView slvResidualInvoiceAmount;
  @BindView(R.id.slv_respManName) SingleLineView slvRespManName;
  @BindView(R.id.slv_dataStatusName) SingleLineView slvDataStatusName;
  @BindView(R.id.slv_regStaffName) SingleLineView slvRegStaffName;
  @BindView(R.id.slv_regDate) SingleLineView slvRegDate;
  private rContractListMain mItem;

  @Override public void initData() {
    super.initData();
    mItem = (!(mBaseParams.getItem() instanceof rContractListMain)) ? new rContractListMain()
        : (rContractListMain) mBaseParams.getItem();
  }

  @Nullable @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
      @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_customer_bill_detail, container, false);
    ButterKnife.bind(this, view);
    return view;
  }

  @Override public void initView(View view, Bundle savedInstanceState) {
    super.initView(view, savedInstanceState);
    setTitleCustom(MyStringUtil.connect(R.string.customerBill, R.string.detail));
    slvContractAmount.getTvContent().setText(MyStringUtil.valueOf(mItem.getContractAmount()));
    slvContractCode.getTvContent().setText(mItem.getContractCode());
    slvContractKindName.getTvContent().setText(mItem.getContractKindName());
    slvContractName.getTvContent().setText(mItem.getContractName());
    slvContractSignDate.getTvContent().setText(mItem.getContractSignDate());
    slvDataStatusName.getTvContent().setText(DataStatus.getDataStatusName(mItem.getDataStatus()));
    slvMakedContractAmount.getTvContent()
        .setText(MyStringUtil.valueOf(mItem.getMakedContractAmount()));
    slvMakedInvoiceAmount.getTvContent()
        .setText(MyStringUtil.valueOf(mItem.getMakedInvoiceAmount()));
    slvPartName.getTvContent().setText(mItem.getPartName());
    slvRegDate.getTvContent().setText(mItem.getRegDate());
    slvRegStaffName.getTvContent().setText(mItem.getRegStaffName());
    slvRequireDate.getTvContent().setText(mItem.getRequireDate());
    slvResidualContractAmount.getTvContent()
        .setText(MyStringUtil.valueOf(mItem.getResidualContractAmount()));
    slvResidualInvoiceAmount.getTvContent()
        .setText(MyStringUtil.valueOf(mItem.getResidualInvoiceAmount()));
    slvRespManName.getTvContent().setText(mItem.getRespManName());
  }
}
